<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema_v1.01.xsd"/>
	<xs:complexType name="TDPEC">
		<xs:annotation>
			<xs:documentation>Tipo Declaração Prévia de Emissão em Contingência - DPEC</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="infDPEC">
				<xs:annotation>
					<xs:documentation>Informações da Declaração Prévia de Emissão em Contingência</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="ideDec">
							<xs:annotation>
								<xs:documentation>Identificação do Declarante, deve ser informado com os dados do emissor das NF-e emitidas em contingência eletrônica</xs:documentation>
							</xs:annotation>
							<xs:complexType>
								<xs:sequence>
									<xs:element name="cUF" type="TCodUfIBGE">
										<xs:annotation>
											<xs:documentation>Código da UF do emitente do Documento Fiscal. Utilizar a Tabela do IBGE.</xs:documentation>
										</xs:annotation>
									</xs:element>
									<xs:element name="tpAmb" type="TAmb">
										<xs:annotation>
											<xs:documentation>Identificação do Ambiente:
1 - Produção
2 - Homologação</xs:documentation>
										</xs:annotation>
									</xs:element>
									<xs:element name="verProc">
										<xs:annotation>
											<xs:documentation>versão do aplicativo utilizado no processo de
emissãodo DPEC</xs:documentation>
										</xs:annotation>
										<xs:simpleType>
											<xs:restriction base="xs:token">
												<xs:minLength value="1"/>
												<xs:maxLength value="20"/>
											</xs:restriction>
										</xs:simpleType>
									</xs:element>
									<xs:element name="CNPJ" type="TCnpj">
										<xs:annotation>
											<xs:documentation>Número do CNPJ do emitente</xs:documentation>
										</xs:annotation>
									</xs:element>
									<xs:element name="IE" type="TIe">
										<xs:annotation>
											<xs:documentation>Inscrição Estadual do emitente</xs:documentation>
										</xs:annotation>
									</xs:element>
								</xs:sequence>
							</xs:complexType>
						</xs:element>
						<xs:element name="resNFe" maxOccurs="50">
							<xs:annotation>
								<xs:documentation>Resumo das NF-e emitidas  no Sistema de Contingência Eletrônica (até 50 NF-e com tpEmiss = "4")</xs:documentation>
							</xs:annotation>
							<xs:complexType>
								<xs:sequence>
									<xs:element name="chNFe" type="TChNFe">
										<xs:annotation>
											<xs:documentation>Chave de Acesso da NF-e emitida em contingência eletrônica</xs:documentation>
										</xs:annotation>
									</xs:element>
									<xs:choice>
										<xs:annotation>
											<xs:documentation>Identificação do Destinatário</xs:documentation>
										</xs:annotation>
										<xs:element name="CNPJ" type="TCnpjOpc">
											<xs:annotation>
												<xs:documentation>CNPJ do destinatário</xs:documentation>
											</xs:annotation>
										</xs:element>
										<xs:element name="CPF" type="TCpf">
											<xs:annotation>
												<xs:documentation>CPF do destintário</xs:documentation>
											</xs:annotation>
										</xs:element>
									</xs:choice>
									<xs:element name="UF" type="TUf">
										<xs:annotation>
											<xs:documentation>Sigla da UF de destinto da mercadoria</xs:documentation>
										</xs:annotation>
									</xs:element>
									<xs:element name="vNF" type="TDec_1302">
										<xs:annotation>
											<xs:documentation>Valor Total da NF-e</xs:documentation>
										</xs:annotation>
									</xs:element>
									<xs:element name="vICMS" type="TDec_1302">
										<xs:annotation>
											<xs:documentation>Valor Total do ICMS da operação própria</xs:documentation>
										</xs:annotation>
									</xs:element>
									<xs:element name="vST" type="TDec_1302">
										<xs:annotation>
											<xs:documentation>Valor Total do ICMS retido por Subsituição Tributária</xs:documentation>
										</xs:annotation>
									</xs:element>
								</xs:sequence>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
					<xs:attribute name="Id" use="required">
						<xs:simpleType>
							<xs:restriction base="xs:ID">
								<xs:pattern value="DPEC[0-9]{14}"/>
							</xs:restriction>
						</xs:simpleType>
					</xs:attribute>
				</xs:complexType>
			</xs:element>
			<xs:element ref="ds:Signature"/>
		</xs:sequence>
		<xs:attribute name="versao" type="TVerDPEC" use="required"/>
	</xs:complexType>
	<xs:complexType name="TRetDPEC">
		<xs:annotation>
			<xs:documentation>Tipo Retorno da Declaração Prévia de Emissão em Contignência - DPEC</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="infDPECReg">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="tpAmb" type="TAmb">
							<xs:annotation>
								<xs:documentation>Identificação do Ambiente:
1 - Produção
2 - Homologação</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:element name="verAplic" type="TVerAplic">
							<xs:annotation>
								<xs:documentation>Versão do Aplicativo que recebeu o DPEC</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:element name="cStat" type="TStat">
							<xs:annotation>
								<xs:documentation>Código do status da recepção do DPEC</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:element name="xMotivo" type="TMotivo">
							<xs:annotation>
								<xs:documentation>Descrição literal do status da recepção do DPEC</xs:documentation>
							</xs:annotation>
						</xs:element>
						<xs:choice minOccurs="0">
							<xs:sequence>
								<xs:element name="dhRegDPEC" type="xs:dateTime">
									<xs:annotation>
										<xs:documentation>Data e Hora de registro da DPEC</xs:documentation>
									</xs:annotation>
								</xs:element>
								<xs:element name="nRegDPEC">
									<xs:annotation>
										<xs:documentation>Número do registro do DPEC</xs:documentation>
									</xs:annotation>
								</xs:element>
								<xs:element name="envDPEC" type="TDPEC">
									<xs:annotation>
										<xs:documentation>Declaração Prévia de Emissão em Contingência</xs:documentation>
									</xs:annotation>
								</xs:element>
							</xs:sequence>
							<xs:sequence>
								<xs:element name="chNFe" type="TChNFe">
									<xs:annotation>
										<xs:documentation>Chave de Acesso da primeira NF-e que causou o erro, se aplicável</xs:documentation>
									</xs:annotation>
								</xs:element>
							</xs:sequence>
						</xs:choice>
					</xs:sequence>
					<xs:attribute name="Id" use="required">
						<xs:simpleType>
							<xs:restriction base="xs:ID">
								<xs:pattern value="RETDPEC[0-9]{14}"/>
							</xs:restriction>
						</xs:simpleType>
					</xs:attribute>
				</xs:complexType>
			</xs:element>
			<xs:element ref="ds:Signature"/>
		</xs:sequence>
		<xs:attribute name="versao" type="TVerDPEC" use="required"/>
	</xs:complexType>
	<xs:complexType name="TConsDPEC">
		<xs:annotation>
			<xs:documentation>Tipo Consulta Declaração prévia de Emissão em Contingência - DPEC</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="tpAmb" type="TAmb">
				<xs:annotation>
					<xs:documentation>Identificação do Ambiente:
1 - Produção
2 - Homologação</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="verAplic" type="TVerAplic">
				<xs:annotation>
					<xs:documentation>Versão do Aplicativo que solicitou a Consulta</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:choice>
				<xs:element name="chNFe" type="TChNFe">
					<xs:annotation>
						<xs:documentation>Chave de Acesso da NF-e</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="nRegDPEC">
					<xs:annotation>
						<xs:documentation>Número de registro do DPEC</xs:documentation>
					</xs:annotation>
				</xs:element>
			</xs:choice>
		</xs:sequence>
		<xs:attribute name="versao" type="TVerDPEC" use="required"/>
	</xs:complexType>
	<xs:complexType name="TRetConsDPEC">
		<xs:annotation>
			<xs:documentation>Tipo Retorno da Consulta da Declaração Prévia de Emissão em Contignência - DPEC</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="tpAmb" type="TAmb">
				<xs:annotation>
					<xs:documentation>Identificação do Ambiente:
1 - Produção
2 - Homologação</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="verAplic" type="TVerAplic">
				<xs:annotation>
					<xs:documentation>Versão do Aplicativo que recebeu o DPEC</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="cStat" type="TStat">
				<xs:annotation>
					<xs:documentation>Código do status da recepção do DPEC</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="xMotivo" type="TMotivo">
				<xs:annotation>
					<xs:documentation>Descrição literal do status da recepção do DPEC</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="retDPEC" type="TRetDPEC" minOccurs="0">
				<xs:annotation>
					<xs:documentation>DPEC localizado</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="versao" type="TVerDPEC" use="required"/>
	</xs:complexType>
	<xs:simpleType name="TAmb">
		<xs:annotation>
			<xs:documentation>Tipo Ambiente</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:enumeration value="1"/>
			<xs:enumeration value="2"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TChNFe">
		<xs:annotation>
			<xs:documentation>Tipo Chave da Nota Fiscal Eletrônica</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="[0-9]{44}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TCnpj">
		<xs:annotation>
			<xs:documentation>Tipo Número do CNPJ</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="[0-9]{14}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TCnpjOpc">
		<xs:annotation>
			<xs:documentation>Tipo Número do CNPJ Opcional</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="[0-9]{0}|[0-9]{14}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TCodUfIBGE">
		<xs:annotation>
			<xs:documentation>Tipo Código da UF da tabela do IBGE</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:enumeration value="11"/>
			<xs:enumeration value="12"/>
			<xs:enumeration value="13"/>
			<xs:enumeration value="14"/>
			<xs:enumeration value="15"/>
			<xs:enumeration value="16"/>
			<xs:enumeration value="17"/>
			<xs:enumeration value="21"/>
			<xs:enumeration value="22"/>
			<xs:enumeration value="23"/>
			<xs:enumeration value="24"/>
			<xs:enumeration value="25"/>
			<xs:enumeration value="26"/>
			<xs:enumeration value="27"/>
			<xs:enumeration value="28"/>
			<xs:enumeration value="29"/>
			<xs:enumeration value="31"/>
			<xs:enumeration value="32"/>
			<xs:enumeration value="33"/>
			<xs:enumeration value="35"/>
			<xs:enumeration value="41"/>
			<xs:enumeration value="42"/>
			<xs:enumeration value="43"/>
			<xs:enumeration value="50"/>
			<xs:enumeration value="51"/>
			<xs:enumeration value="52"/>
			<xs:enumeration value="53"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TCodMunIBGE">
		<xs:annotation>
			<xs:documentation>Tipo Código do Município da tabela do IBGE</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="[0-9]{7}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TCpf">
		<xs:annotation>
			<xs:documentation>Tipo Número do CPF</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="[0-9]{11}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TDec_1302">
		<xs:annotation>
			<xs:documentation>Tipo Decimal com 15 dígitos, sendo 13 de corpo e 2 decimais</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="0|0\.[0-9]{2}|[1-9]{1}[0-9]{0,12}(\.[0-9]{2})?"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TIe">
		<xs:annotation>
			<xs:documentation>Tipo Inscrição Estadual do Emissor</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:pattern value="[0-9]{2,14}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TMotivo">
		<xs:annotation>
			<xs:documentation>Tipo Motivo</xs:documentation>
		</xs:annotation>
		<xs:restriction base="TString">
			<xs:maxLength value="255"/>
			<xs:minLength value="1"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TProt">
		<xs:annotation>
			<xs:documentation>Tipo Número do Protocolo de Status</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="[0-9]{15}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TRec">
		<xs:annotation>
			<xs:documentation>Tipo Número do Recibo do envio de lote de NF-e</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="[0-9]{15}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TStat">
		<xs:annotation>
			<xs:documentation>Tipo Código da Mensagem enviada</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="[0-9]{3}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TString">
		<xs:annotation>
			<xs:documentation> Tipo string genérico</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="[!-ÿ]{1}[ -ÿ]{0,}[!-ÿ]{1}|[!-ÿ]{1}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TUf">
		<xs:annotation>
			<xs:documentation>Tipo Sigla da UF</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:enumeration value="AC"/>
			<xs:enumeration value="AL"/>
			<xs:enumeration value="AM"/>
			<xs:enumeration value="AP"/>
			<xs:enumeration value="BA"/>
			<xs:enumeration value="CE"/>
			<xs:enumeration value="DF"/>
			<xs:enumeration value="ES"/>
			<xs:enumeration value="GO"/>
			<xs:enumeration value="MA"/>
			<xs:enumeration value="MG"/>
			<xs:enumeration value="MS"/>
			<xs:enumeration value="MT"/>
			<xs:enumeration value="PA"/>
			<xs:enumeration value="PB"/>
			<xs:enumeration value="PE"/>
			<xs:enumeration value="PI"/>
			<xs:enumeration value="PR"/>
			<xs:enumeration value="RJ"/>
			<xs:enumeration value="RN"/>
			<xs:enumeration value="RO"/>
			<xs:enumeration value="RR"/>
			<xs:enumeration value="RS"/>
			<xs:enumeration value="SC"/>
			<xs:enumeration value="SE"/>
			<xs:enumeration value="SP"/>
			<xs:enumeration value="TO"/>
			<xs:enumeration value="EX"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TVerAplic">
		<xs:annotation>
			<xs:documentation>Tipo Versão do Aplicativo</xs:documentation>
		</xs:annotation>
		<xs:restriction base="TString">
			<xs:minLength value="1"/>
			<xs:maxLength value="20"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="TVerDPEC">
		<xs:annotation>
			<xs:documentation>Tipo Versão do DPEC</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:pattern value="1\.01"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
